<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
        <title>后台管理系统</title>
		<link rel="stylesheet" href="__ADMIN_STATIC__/pear/css/pear.css" />
		<link rel="stylesheet" href="__ADMIN_STATIC__/css/other/login.css" />
    </head>
    <!-- 代 码 结 构 -->
	<body background="__ADMIN_STATIC__/images/background2.svg" style="background-size: cover;">
		<form class="layui-form" action="javascript:void(0);">
			<div class="layui-form-item">
				<img class="logo" src="{$avatar}" />
				<div class="title">账户绑定</div>
			</div>
            <div class="layui-form-item">
                <input type="text" name="username"
                       placeholder="用户名"  class="layui-input">
            </div>
            <div class="layui-form-item password-block">
                <input type="password" name="password"
                       placeholder="密码"  class="layui-input">
            </div>
			<div class="layui-form-item">
				<button class="pear-btn pear-btn-success login" lay-submit
                lay-filter="login-submit" id="login">
					绑 定
				</button>
			</div>
		</form>
		<!-- 资 源 引 入 -->
		<script src="__ADMIN_STATIC__/layui/layui.js"></script>
        <script src="__ADMIN_STATIC__/pear/pear.js"></script>

	</body>
</html>
<script>
	layui.use(['form', 'element', 'jquery', 'button'], function() {
		var form = layui.form;
		var element = layui.element;
		var button = layui.button;
		var $ = layui.jquery;
		// 登 录 提 交
		form.on('submit(login-submit)', function(data) {
			button.load({
				elem: '.login',
				time: 100,
				done: function() {
					$.ajax({
						data: data.field,
						type:"POST",
						dataType:"json",
						url: "wxRegister",
						success: function(res) {
							if (res.code=='200'){
								layer.msg(res.msg, {
									icon: 1,
									time: 2000
								}, function() {
									window.location.href= "https://erp.yd1995.com/admin.php";
								});
							}else {
								layer.msg(res.msg, {
									icon: 2,
								});
							}
						},
						error: function() {
							layer.msg('系统异常', {
								icon: 0,
							});
						}
					});
					return false;
				}
			})
		});
	});
</script>
